using System.Collections.Generic;

namespace Actya.Core.SiteStructure
{
	public interface IPageService
	{
		/// <summary>
		/// Find a page by the given url. 
		/// </summary>
		/// <param name="url"></param>
		/// <returns></returns>
		Page FindPageByUrl(string url);

		/// <summary>
		/// Get the pages order by date modified.
		/// </summary>
		/// <param name="pageIndex"></param>
		/// <param name="pageSize"></param>
		/// <param name="total"></param>
		/// <returns></returns>
		IEnumerable<Page> GetMostRecentPages(int pageIndex, int pageSize, out int total);

		/// <summary>
		/// Get a single page by id.
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		Page GetPageById(string id);

	    /// <summary>
	    /// Save the given page.
	    /// </summary>
	    /// <param name="page"></param>
	    /// <param name="includeInNavigation"></param>
	    /// <param name="parentNodeId"></param>
	    /// <param name="menuText"></param>
	    /// <param name="isHomePage"></param>
	    void CreatePage(Page page, bool includeInNavigation, string parentNodeId, string menuText, bool isHomePage);

		/// <summary>
		/// Updates the given page.
		/// </summary>
		/// <param name="page"></param>
		/// <param name="includeInNavigation"></param>
		/// <param name="parentNodeId"></param>
		/// <param name="menuText"></param>
		/// <param name="isHomePage"></param>
		void UpdatePage(Page page, bool includeInNavigation, string parentNodeId, string menuText, bool isHomePage);

		/// <summary>
		/// Search for pages that have the search term in the title or url.
		/// </summary>
		/// <param name="term"></param>
		/// <returns></returns>
		IEnumerable<Page> SearchPages(string term);

		/// <summary>
		/// Delete the given page.
		/// </summary>
		/// <param name="page"></param>
		void DeletePage(Page page);

		/// <summary>
		/// Find pages by layout id.
		/// </summary>
		/// <param name="layoutId"></param>
		/// <returns></returns>
		IEnumerable<Page> FindPageByLayout(string layoutId);

		/// <summary>
		/// Unpublish the given page.
		/// </summary>
		/// <param name="page"></param>
		void UnPublishPage(Page page);

		/// <summary>
		/// Filter the given list with page id's for navigation. Only returns id's for published and authorized pages.
		/// </summary>
		/// <param name="allPageIds"></param>
		string[] GetPublishedAndAuthorizedPageIds(string[] allPageIds);

		/// <summary>
		/// Save the given page as preview page.
		/// </summary>
		/// <param name="page"></param>
		void CreatePreviewPage(Page page);
	}
}